package cn.wen.forum.service;

import cn.wen.forum.common.result.JSONResult;
import cn.wen.forum.pojo.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface IUserService extends IService<User> {

    /**
     * 用户登录
     * @param user
     * @return
     */
    JSONResult login(User user,HttpServletResponse response) throws Exception;

    /**
     * 注册并登录
     * @param user
     * @return
     */
    JSONResult register(User user,HttpServletResponse response);

    /**
     * 从token中获取用户信息
     * @param request
     * @return
     */
    JSONResult getUser(HttpServletRequest request) throws Exception;

    /**
     * 退出登录
     * @param request
     * @return
     */
    JSONResult logout(HttpServletRequest request);
}
